module.exports {
		//得到对应商品的对应商品数量
	getGoodsCounts(state){
		var counts = {}
		state.car.forEach( element => {
			counts[element.id] = parseInt(element.counts)
		});
		// console.log(counts)
		return counts
	},
	//得到商品选择zhuangtai
	getSelected(state){
		var selected = {}
		state.car.forEach( element => {
			selected[element.id] = element.selected
		});
		// console.log(selected)
		return selected 
	},
	//得到价格和数量
	getPriceAndCounts(state){
	 var list = {
		 price:0,
		 counts:0
	 }
	 state.car.forEach(element => {
		 if(element.selected){
			 list.price += element.counts * element.price
			 list.counts += element.counts
		 }
	 })
	//  console.log(list)
	 return list
	}
}
